/*C://xampp//htdocs//TelevisaGit//\art_latestnews_01\js\art_latestnews_01.js*/

 /* ******************************************************* */ 
 $(document).ready(function() {
    (function(T, $) {
        var onDocumentReady = function() {
            var $p = $('div.art_latestnews_01');   
            $p.each(function() {
                var $parent = $(this);
                var $clickListA = $parent.find('.art_latestnews_01_lasth');
                var $clickListB = $parent.find('.art_latestnews_01_morev');
                var $overLink = $parent.find('.art_latestnews_01_list1 li');
                $clickListA.bind('click', function(evt) {
                    evt.preventDefault();
                    $parent.find('.art_latestnews_01_morev').removeClass("selected");
                    $(this).addClass("selected");
                    $parent.find('.art_latestnews_01_list1').show();
                    $parent.find('.art_latestnews_01_list2').hide();
                });
                $clickListB.bind('click', function(evt) {
                    evt.preventDefault();
                    $(this).addClass("selected");
                    $parent.find('.art_latestnews_01_lasth').removeClass("selected");
                    $parent.find('.art_latestnews_01_list1').hide();
                    $parent.find('.art_latestnews_01_list2').show();
                });
                if (T.getDeviceSize() == 'large') {
                    $overLink.bind('mouseover', function(evt) {
                        evt.preventDefault();
                        $(this).find('.art_latestnews_01_over').css("display","block");
                    });
                    $overLink.bind('mouseout', function(evt) {
                        evt.preventDefault();
                        $(this).find('.art_latestnews_01_over').css("display","none");
                    });   
                } 
                $(window).resize(function() {

                    var $overLinkB = $parent.find('.art_latestnews_01_list1 li');

                    if( $(window).width() > 960 ){
                        $overLinkB.bind('mouseover', function(evt) {
                            evt.preventDefault();
                            $(this).find('.art_latestnews_01_over').css("display","block");
                        });
                        $overLinkB.bind('mouseout', function(evt) {
                            evt.preventDefault();
                            $(this).find('.art_latestnews_01_over').css("display","none");
                        });   
                    }
                    if( $(window).width() <= 960 ){
                        $overLinkB.bind('mouseover', function(evt) {
                            evt.preventDefault();
                            $(this).find('.art_latestnews_01_over').css("display","none");
                        });
                    }
                });
            });
        };

        $(onDocumentReady);
    }(Televisa, jQuery));

});/*C://xampp//htdocs//TelevisaGit//\art_latestnews_01\js\art_latestnews_01.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\btn_6prog_02\js\btn_6prog_02.js*/

 /* ******************************************************* */ 
 $(document).ready(function() {	
	
        var lis = $('.btn_6prog_02 .type1a .carrusel ul li');
        var margin = 0;
        var ulWidth = 0;
        for(var i=0; i<lis.length; i++){
            margin += parseInt($(lis[i]).css("margin-left"));
            ulWidth += $(lis[i]).width();
        }
        $(".btn_6prog_02 .type1a .carrusel ul").width(ulWidth + margin);
        
        
        
	// sacamos cuantas imagenes
	//var totalImagenes = $(".btn_6prog_02 .type1a .carrusel ul").length;
	
	// Sacamos el ancho total del UL del carrusel
	var anchoTotalUL = $(".btn_6prog_02 .type1a .carrusel ul").width(); // 100%
	
	
	var bulletSelected;
	var scrollLeft;
	
	if ($.browser.msie && parseInt($.browser.version, 10) <= 7){
		var anchoVentna = document.body.offsetWidth;
		//alert($.width());
		//alert(document.body.offsetWidth);
	}
	else{
		var anchoVentna =  $(window).width();
	}
	
	
	// checamos si se deben mostrar las flechas del carrusel si hay mas de 6 elementos
	if(anchoVentna > 590){
		
		if($(".btn_6prog_02 .type1a .carrusel ul li").length > 6){
			
			$(".btn_6prog_02 .title .flechas").show();
		}
		else{
			$(".btn_6prog_02 .title .flechas").hide();
		}
		
	}
	
	
	$('.btn_6prog_02 .type1a .carrusel').scroll(function(e){
		
		scrollLeft = $(this).scrollLeft() + (anchoVentna/2.5) ;
		
		//alert ( scrollLeft );
        
		var porcentaje =  ( scrollLeft * 100) / anchoTotalUL; 
		
		if( porcentaje >= 64)
			bulletSelected = 5;
		else if( porcentaje >= 50)
			bulletSelected = 4;
		else if( porcentaje >= 35)
			bulletSelected = 3;
		else if( porcentaje >= 25)
			bulletSelected = 2;
		else 
			bulletSelected = 1;
			
		//alert(bulletSelected);
		
		$('.btn_6prog_02 .bullets ul li').removeClass('selected');
		$(".btn_6prog_02 .bullets ul li:nth-child("+bulletSelected+")").addClass('selected');
    });

});/*C://xampp//htdocs//TelevisaGit//\btn_6prog_02\js\btn_6prog_02.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\img_fotogalfull_01\js\img_fotogalfull_01.js*/

 /* ******************************************************* */ 
 var delaySecs = 3; // Delay entre cambio y cambio de imagenes en el autoplay
var intervalID;
var  totalLis; // Numero total de li's del carrusel 1

$(document).ready(function() {
	
	var lis = $('.img_fotogalfull_01 .type1a .carruselcontainer ul li');
        var margin_l = 0;
        var ulWidth = 0;
        for(var i=0; i<lis.length; i++){
            margin_l += parseInt($(lis[i]).css("margin-left"));
            ulWidth += $(lis[i]).width();
            
        }
        $('.img_fotogalfull_01 .type1a .carruselcontainer ul').width(ulWidth + margin_l +4 );
        
        // Ponemos el texto del overlay Desktop en el Overlay del mobile
	$('.img_fotogalfull_01 .overlay_mobile p').text( $('.img_fotogalfull_01 .overlay p').text() );
	
	// Click en la imagen de la galeria
	$('.img_fotogalfull_01 .carrusel1_img').click( function (){
		
		// Quitamos el timer del autoplay
		//alert(intervalID);
		clearInterval(intervalID);
		
		// reseteamos los botones
		$('#videobtn').removeClass('stop');
		$('#videobtn').addClass('play');
		
		clickGaleria(this);
		
	});
	
	// Ponemos las ligas de compartir
	var obj = $('.img_fotogalfull_01 #firstImg');
	setShareURL(obj);
	
	// click en el boton de Play o pausa
	$('#videobtn').click( function (){	
		play();				
	});
	
	
	
	// Sacamos el total de los li's para saber cuando hacer scroll
	totalLis = $('.img_fotogalfull_01 #carrusel2_ul li').length;
	
	if ($.browser.msie && parseInt($.browser.version, 10) <= 7){
		var anchoVentna = document.body.offsetWidth;
		//alert($.width());
		//alert(document.body.offsetWidth);
	}
	else{
		var anchoVentna =  $(window).width();
	}
	
	
	
	var anchoUL_carrusel;
	
	if(anchoVentna > 590){
			
		anchoUL_carrusel = $('.img_fotogalfull_01 #carrusel2 #carrusel2_ul').width();
		//alert(anchoUL_carrusel);
	}
	
	$(window).resize(function() {
		//alert(ancho);
		if(anchoVentna < 590){
			
			$('.img_fotogalfull_01 #carrusel2 #carrusel2_ul').css('width','auto');
		}
		else{
			$('.img_fotogalfull_01 #carrusel2 #carrusel2_ul').css('width', anchoUL_carrusel);
		}
		
		
		// Ajustamos el tamaño del carrusel para respetar la col derecha
		ajustarTamanoCarrusel();
		
	});
	
	ajustarTamanoCarrusel();

});


// funcion que encuentra la siguiente imagen a hacer click tomando en cuenta la que está YA seleccionada
function findNextImgGallery(){
	
	
	
	// Buscamos la siguiente imagen
	var obj = $('.img_fotogalfull_01 .carrusel1_img  img.img_galry_01_selected').closest('li').next().find('.carrusel1_img');
	
	if( obj.is("a") ){
		
		clickGaleria(obj);
	}
	else{
		// Animamos el carrusel al inicio
		$('#division_dotted').animate({
				'scrollLeft': 0
		});
		
		var obj = $('.img_fotogalfull_01 #firstImg');
		clickGaleria(obj);
	}
	
	
	//alert($(obj).attr('id'));
}


// Funcion que simula un "click" en una imagen determinada de la galeria
function clickGaleria(obj){
	
	// si esta en autoplay paramos el timer para esperar a que cargue la nueva imagen
	if( $('#videobtn').hasClass('stop') ){
		clearInterval(intervalID);			
	}
	
	var imagen = $(obj).attr('img');
	var decription = $(obj).attr('title');
	
	
	//$(obj).parents('.img_fotogalfull_01').find('#img_galry_01_IMG').attr('src', imagen);
	//$(".img_fotogalfull_01 #img_fotogalfull_01_left #imgContainer").height( $(".img_fotogalfull_01 #img_galry_01_IMG").height() + 5 );
	
	// quitamos la imagen
	//$(".img_fotogalfull_01 #img_galry_01_IMG").remove();
	//$(".img_fotogalfull_01 #img_galry_01_IMG").attr("src",'');
	
    
	// Creamos una al vuelo
	/*var img = new Image();
	img.src = imagen;
	img.id = 'img_galry_01_IMG';
	img.onload = function() {*/
	
	$(".img_fotogalfull_01 #img_galry_01_IMG").attr("src",imagen).ready(function(){
		
		//alert('ya');
		// Agregamos la imagen
		//$(".img_fotogalfull_01 #img_fotogalfull_01_left #imgContainer").append(img);
		
		// YA QUE CARGÓ LA IMAGEN... ENTONCES... 
		
		// Ponemos el texto del overlay Desktop en el Overlay 
		$('.img_fotogalfull_01 .overlay_mobile p').text( decription );
		$('.img_fotogalfull_01 .overlay p').text( decription );
		
		//alert('q');
		// quitamos el borde
		$( '.img_fotogalfull_01 .carrusel1_img img' ).removeClass('img_galry_01_selected');
		
		
		// ponemos borde al anchor que le dieron click
		$(obj).children('img').addClass('img_galry_01_selected');
		
		// sacamos el NUMERO DE li que estara activo para saber si hacemos SCROLL en el carrusel1
		var selectedIndex = $('.img_fotogalfull_01 .carrusel1_img  img.img_galry_01_selected').closest('li').index() + 1;
		
		// Si esta corriendo el autoplay
		if ( $('#videobtn').hasClass('stop')  ){
			
			if ($.browser.msie && parseInt($.browser.version, 10) <= 7){
				var anchoVentna = document.body.offsetWidth;
				//alert($.width());
				//alert(document.body.offsetWidth);
			}
			else{
				var anchoVentna =  $(window).width();
			}
			
			if ( anchoVentna < 630 && ( selectedIndex == 6 || selectedIndex == 12 || selectedIndex == 18 || selectedIndex == 24 || selectedIndex == 30) ){
			
				//alert(selectedIndex);
				$('.img_fotogalfull_01 #carrusel1 #rightC1').click();
				
			}
			else if ( anchoVentna > 630 && ( selectedIndex == 10 || selectedIndex == 20 || selectedIndex == 30 || selectedIndex == 40 || selectedIndex == 50) ){
				$('.img_fotogalfull_01 #carrusel1 #rightC1').click();
			}
			
		}
	});
	
	// si esta en autoplay
	if( $('#videobtn').hasClass('stop') ){
		
		intervalID = window.setInterval("findNextImgGallery()", (delaySecs * 1000));
		
	}
	
	// ponemos los links de compartir
	setShareURL(obj);
	
}


function setShareURL(obj){
	
	var photo_id = $(obj).attr('idImg');
	
	// cambiamos el link de compartir de fb, tw y pn
	var shareUrl = window.location.href.substr(0, window.location.href.indexOf('#'));
	shareUrl = shareUrl + '#ph='+photo_id;
	
	var shareUrlBase = "http://www.televisa.com";
	
	//$('.img_galry_01 #lnk_pinterest').attr('href', $('.img_galry_01 #hidden_pinterest').attr('href')+shareUrlBase+shareUrl);
	$('.img_fotogalfull_01 #lnk_twitter').attr('href', 'https://twitter.com/intent/tweet?original_referer=https%3A%2F%2Ftelevisa.com&via='+shareUrlBase+'/?u='+shareUrl);
	$('.img_fotogalfull_01 #lnk_facebook').attr('href', 'https://www.facebook.com/sharer/sharer.php?u='+shareUrlBase+shareUrl);
}


function ajustarTamanoCarrusel(){
	
	
	if ($.browser.msie && parseInt($.browser.version, 10) <= 7){
		var anchoVentna = document.body.offsetWidth;
		//alert($.width());
		//alert(document.body.offsetWidth);
	}
	else{
		var anchoVentna =  $(window).width();
	}
	
	
	
	// Ajustamos el tamaño dela col izq para respetar la col derecha
	
	// Tablet
	if( anchoVentna  <= 960)
		$('.img_fotogalfull_01 #img_fotogalfull_01_left').width( '100%' );
	// Desktop
	else
		$('.img_fotogalfull_01 #img_fotogalfull_01_left').width( anchoVentna - 360 );
		
		
	
	//Ajustamos el alto del a col derecha
	if( $('#img_galry_01_IMG').height() > 270)
		$('.img_fotogalfull_01 .txt1').height( $('#img_galry_01_IMG').height() - 185 );
		
	if( anchoVentna < 960)
		$('.img_fotogalfull_01 .txt1').height( 'auto' );
		
	
	/*Ajustamos el ancho del overlay*/
	if( anchoVentna <= 620 )
		$('.img_fotogalfull_01 .overlay').width( $('#img_galry_01_IMG').width() -30);
	else
		$('.img_fotogalfull_01 .overlay').width( $('#img_galry_01_IMG').width() - 102 );
	
}

// BTN FWD (mobile)
function fwd(){

	findNextImgGallery();
	
}

// Btn rwd (mobile)
function rwd(){

	var obj = $('.img_fotogalfull_01 #carrusel1_ul').find('.img_galry_01_selected').closest('li').prev().find('a');
	//alert( $(obj).attr('img') );
	
	if( obj.is("a") ){
		clickGaleria(obj);
	}
	else{
		
		//$('.img_fotogalfull_01 #firstImg').trigger('click');
		var obj = $('.img_fotogalfull_01 #firstImg');
		clickGaleria(obj);
		
		// Animamos el carrusel al inicio
		$('#division_dotted').animate({
				'scrollLeft': 0
		});
	}
	
	/*$('.img_fotogalfull_01 #carrusel1_ul').find('.img_galry_01_selected').removeClass('img_galry_01_selected');
	
	
	$('.img_fotogalfull_01').find('#img_galry_01_IMG').attr('src', '');
	$('.img_fotogalfull_01').find('#img_galry_01_IMG').attr('src', $(obj).attr('img'));
	$(obj).find('img').addClass('img_galry_01_selected');*/	
}

function play(){
	
	
	// si esta corriendo el autoplay
	if($('#videobtn').hasClass('stop')){
		
		$('.img_fotogalfull_01 .displayControls #pause').hide();
		$('.img_fotogalfull_01 .displayControls #play').show();
		
		//alert(intervalID);
		$('#videobtn').removeClass('stop');
		$('#videobtn').addClass('play');
		clearInterval(intervalID);
	}
	else{
		
		// Version mobile
		$('.img_fotogalfull_01 .displayControls #play').hide();
		$('.img_fotogalfull_01 .displayControls #pause').show();
		
		
		// version desktop
		$('#videobtn').removeClass('play');
		$('#videobtn').addClass('stop');
		
		
		intervalID = window.setInterval("findNextImgGallery()", (delaySecs * 1000));
	}
}/*C://xampp//htdocs//TelevisaGit//\img_fotogalfull_01\js\img_fotogalfull_01.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\img_galry_01\js\img_galry_01.js*/

 /* ******************************************************* */ 
 img_galry_01_js = new Object();

img_galry_01_js.delaySecs = 3; // Delay entre cambio y cambio de imagenes en el autoplay
img_galry_01_js.intervalID;
img_galry_01_js.totalLis; // Numero total de li's del carrusel 1
img_galry_01_js.jsonurl =  "../json/img_galry_01.php?g="; // Ajax Json URL
img_galry_01_js.anchoUL_carrusel;
img_galry_01_js.idGallery;

var btnPlay;


//head.ready(function() {
$(document).ready(function() {	
    var lis = $('.img_galry_01 .type1a .carruselcontainer ul li');
        var margin_l = 0;
        var margin_r = 0;
        var ulWidth = 0;
        for(var i=0; i<lis.length; i++){
            margin_l += parseInt($(lis[i]).css("margin-left"));
            margin_r += parseInt($(lis[i]).css("margin-right"));
            ulWidth += $(lis[i]).width();
        }
        $('.img_galry_01 .type1a .carruselcontainer ul').width(ulWidth + margin_l + margin_r + 10);
    
    // Si entran en movil se quita el ancho fijo que pone el carrusel al 'ul'
    $(window).load(function() {
        if($(window).width() <= 590){			
            $('.img_galry_01 #carrusel2 #carrusel2_ul').css('width', $(window).width());			
        }
        else{
            img_galry_01_js.anchoUL_carrusel = $('.img_galry_01 #carrusel2 #carrusel2_ul').width();
        //alert(img_galry_01_js.anchoUL_carrusel);
        }
		
		// Si son menos de 7 elem en el 1er carrusel no se muestran las flechas
		if( $('.img_galry_01 #carrusel1_ul li').length < 7){
				
			
			$('.img_galry_01 #carrusel1 .arrowLeft a').html('&nbsp;');
			$('.img_galry_01 #carrusel1 .arrowRight a').html('&nbsp;');
		}
    });	
	
	// Si son mas de 3 elem en el 2do carrusel se muestran las flechas
	if( $('.img_galry_01 #carrusel2_ul li').length < 4){
			
		$('.img_galry_01 #carrusel2 .arrowLeft a').html('&nbsp;');
		$('.img_galry_01 #carrusel2 .arrowRight a').html('&nbsp;');
	}
	
	
    // Bind del click en el boton de Play o pausa
    $('.play').bind('click', function(event) {
        event.preventDefault();		
		
        btnPlay = $(this);		
        // si esta corriendo el autoplay
        if($(this).hasClass('stop')){
            //alert(img_galry_01_js.intervalID);
            $(this).removeClass('stop');
            $(this).addClass('play');
            clearInterval(img_galry_01_js.intervalID);
        }
        else{
            $(this).removeClass('play');
            $(this).addClass('stop');
            //$('.img_galry_01 #firstImg').trigger('click');
            img_galry_01_js.intervalID = window.setInterval( function(){
                findNextImgGallery(btnPlay)
            }, (img_galry_01_js.delaySecs * 1000));
        }				
    });	
	
	
    // Bind del carrsuel 2 con la galeria escogida
    $('.img_galry_01 .galleryLink').click( function (event){
				
        // Si es version tablet o desktop
        if($(window).width() > 590){			
            event.preventDefault();			
            img_galry_01_js.idGallery = $(this).attr('galleryid');
					
            // Quitamos el estilo y agregamos el estilo "sellecionado" a la imagen que le dieron click
            $(this).parents('.img_galry_01').find('.galleryLink').each( function (){				
                $(this).find('div.selectedGallery').removeClass('selectedGallery');
            });	
			
            $(this).find('.iconGallery').addClass('selectedGallery');			
            fillCarousel(img_galry_01_js.idGallery, '',  $(this).parents('.img_galry_01'));
        }
        else{
            event.preventDefault();	
            var textDesc = $(this).find(".gal_desc").text();
            var imgSrc = $(this).find("img").attr("src");
            $(".img_galry_01 #imgContainer").find("img").attr("src",imgSrc);
            $(".img_galry_01 .overlay .overlay2 p#imageDescription").text(textDesc);
        }
		
    });		
    // Boton del VER MAS (Movil)
    $('.img_galry_01 #img_galry_01_btnverMas').click( function (){
		
        $(this).parents('.img_galry_01').find('#carrusel2 #carrusel2_ul li').show();
        $(this).hide();
    });
	
	
	
    // Sacamos el total de los li's para saber cuando hacer scroll
    img_galry_01_js.totalLis = $('.img_galry_01 #carrusel2_ul li').length;

	
    $(window).resize(function() {
        //alert(ancho);
        if($(window).width() < 590){
			
            $('.img_galry_01 #carrusel2 #carrusel2_ul').css('width','auto');
        }
        else{
            $('.img_galry_01 #carrusel2 #carrusel2_ul').css('width', img_galry_01_js.anchoUL_carrusel);
        }
    });
	
	
	
	
	
    ////////////////////////// Se llenan los li's del carrusel UNO /////////////////////////////////
	
	
	
    var hash = window.location.hash;
	
    // obtenemos el photoID del hash
    if(hash.indexOf('ph=') > -1){
        var index = hash.indexOf('ph=');
		
        var photoid = hash.substring(index+3, index+4);
    //alert(photoid);
    }
	
	
    // obtenemos el galleryID del hash
    if(hash.indexOf('g=') > -1){
        var index = hash.indexOf('g=');
        //alert(index);
        img_galry_01_js.idGallery = hash.substring(index+2, index+3);
    //alert(img_galry_01_js.idGallery);
    }
    else{
        // Sino viene ninguna galeria por el hash obtnemos el id del PRIMER elemento del CARRUSEL 2
        img_galry_01_js.idGallery = $('.img_galry_01 #carrusel2_ul .galleryLink:first').attr('galleryid');
		
    }
	
    if (typeof( $('img_galry_01') ) != "undefined")
        fillCarousel(img_galry_01_js.idGallery, photoid ,'');

});


// funcion que encuentra la siguiente imagen a hacer click tomando en cuenta la que está YA seleccionada
function findNextImgGallery(btnPlay){
	
	
    //$(btnPlay).css('border', '1px solid red');
	
    // Buscamos la siguiente imagen
    //var obj = $('.img_galry_01 .carrusel1_img  img.img_galry_01_selected').closest('li').next().find('.carrusel1_img');
    var obj = $(btnPlay).parents('.img_galry_01').find('.carrusel1_img  img.img_galry_01_selected').closest('li').next().find('.carrusel1_img');
	
    if( obj.is("a") ){
        clickGaleria(obj);
    }
    else{
		
        //$('.img_galry_01 #firstImg').trigger('click');
        var obj = $(btnPlay).parents('.img_galry_01').find('#firstImg');
        clickGaleria(obj);
		
        resetCarrusel1stImg();
    }
	
	
//alert($(obj).attr('id'));
}



function resetCarrusel1stImg(){
	
    // Animamos el carrusel al inicio
    $('#division_dotted').animate({
        'scrollLeft': 0
    });
}


// Funcion que simula un "click" en una imagen determinada de la galeria
function clickGaleria(obj){
	
    // Quitamos la imagen grande
    $(obj).parents('.img_galry_01').find('#img_galry_01_IMG').attr('src', '');
	
	
    var imagen = $(obj).attr('img');
    $(obj).parents('.img_galry_01').find('#img_galry_01_IMG').attr('src', imagen);	
	
    // quitamos el borde
    $(obj).parents('.img_galry_01').find('.carrusel1_img img' ).each(function( index ) {
        $(this).removeClass('img_galry_01_selected');
    });
	
    // ponemos borde al anchor que le dieron click
    $(obj).children('img').addClass('img_galry_01_selected');
	
    // Cambiamos el texto del Overlay
    setOverlayText($(obj).attr('title'));
	
    // sacamos el NUMERO DE li que estara activo para saber si hacemos SCROLL en el carrusel1
    var selectedIndex = $(obj).parents('.img_galry_01').find('.carrusel1_img  img.img_galry_01_selected').closest('li').index() + 1;
    if(selectedIndex == 7 || selectedIndex == 14 || selectedIndex == 21 || selectedIndex == 28 || selectedIndex == 35){
		
        var rightArrow = $('.img_galry_01 #carrusel1 #rightC1');
        //$(rightArrow).trigger('Pointer.DOWN');
        $(rightArrow).mousedown();
		
    }
	
    var photo_id = $(obj).children('img').attr('id');
	
    // cambiamos el link de compartir de fb, tw y pn
	if(window.location.href.indexOf('#') > 0)
    	var shareUrl = window.location.href.substr(0, window.location.href.indexOf('#'));
	else
		var shareUrl = window.location.href;
	
    shareUrl = shareUrl + '#g='+img_galry_01_js.idGallery+'&ph='+photo_id;
	
	
    var shareTitle = "Fotogaleria%20Televisa";
	
    //$('.img_galry_01 #lnk_pinterest').attr('href', $('.img_galry_01 #hidden_pinterest').attr('href')+shareUrlBase+shareUrl);
    $('.img_galry_01 #lnk_twitter').attr('href', 'http://twitter.com/share?text='+shareTitle+'&url='+shareUrl);
    $('.img_galry_01 #lnk_facebook').attr('href', 'https://www.facebook.com/sharer/sharer.php?u='+shareUrl+'&t='+shareTitle);
	
}



// funcion que llena el primer carrusel con un id de galeria 
function fillCarousel(idGallery, idSelPhoto, galleryObj){
	
    //alert(img_galry_01_js.idGallery);
	
	if($.isEmptyObject(galleryObj))
		var galleryObj = $('.img_galry_01');
	
    // quitamos todos los li's del carrusel
    $(galleryObj).find('#carrusel1_ul').children().remove();
	
    // Quitamos la imagen grande
    $(galleryObj).find('#img_galry_01_IMG').attr('src', '');
	
	
	
    var jsonRequest  = img_galry_01_js.jsonurl + idGallery
	
	
    // Hacemos la consulta json
    $.getJSON( jsonRequest, function(data) {
		
        var items = [];
        var contador = 1;
        var primeraimg = '';
		
        // Recorremos la info por CADA foto regresada
        $.each(data.photos, function(id, photo) {
			
            var selected = "";
			
            // Ponmos la imagen grande
            $(galleryObj).find('#img_galry_01_IMG').attr('src', photo.image);
			
            // ponemos la clase a la 1era imagen
            if(contador == 1)
                primeraimg = 'firstImg';
            else
                primeraimg = '';
			
            // ponemos el titulo del imagen en el recuadro blanco
            setOverlayText(photo.title);
			
			
            // Guardamos el id de la photo seleccionada VIA HASH (sino abajo seleccionaremos la 1era imagen de la galeria selccionada/default)
            if(parseInt(idSelPhoto) > 0 && idSelPhoto == photo.id){

                selected = 'img_galry_01_selected';
            }
			
				
            $(galleryObj).find('#carrusel1_ul').append('<li><a href="javascript: void(0);" img="'+photo.image+'" title="'+photo.title+'" class="carrusel1_img" id="'+primeraimg+'"><img src="'+photo.thumb+'" alt="'+photo.title+'" class="'+selected+'" id="'+photo.id+'"></a></li>');
            //alert(photo.thumb);
	
            contador++;
			
        });
		
		
		
        // agregamos el comportamiento del carrusel a los elementos agregados anteriormente
        doCarruselTelevisa('.img_galry_01 #division_dotted', jQuery, Televisa);
		
	
        // Agregamos el evento click a los elementos anteriormente generados al vuelo
        $(galleryObj).find('.carrusel1_img').live('click', function (){
			
			
            // Quitamos el timer del autoplay
            //alert(img_galry_01_js.intervalID);
            clearInterval(img_galry_01_js.intervalID);
			
            // reseteamos los botones
            $('#videobtn').removeClass('stop');
            $('#videobtn').addClass('play');
			
            clickGaleria(this);
            setOverlayText($(this).attr('title'));
			
        });
		
        // simulamos el click de la imagen correspondiente, ya sea la default o la escogida via hash
        if(parseInt(idSelPhoto) > 0){
			
            var obj = $(galleryObj).find('.carrusel1_img  img.img_galry_01_selected').parent();
        }
        else{
            var obj = $(galleryObj).find('#firstImg');
        }
		
        clickGaleria(obj);
			
    //resetCarrusel1stImg();
	
    });
}



function setOverlayText(texto){
    $(btnPlay).parents('.img_galry_01').find('#imageDescription').text(texto);
}





function doCarruselTelevisa (id, $, T) {

    var $m = $(id),
    animationDelay = 500;

    $m.each(function() {
				
        var $items = $(this).find('ul li'),
        padding = ($(this).parent().hasClass('type1c')) ? 41 : 0,
        Pointer = {
            UP: (T.getIsTouchDevice()) ? 'touchend' : 'mouseup',
            DOWN: (T.getIsTouchDevice()) ? 'touchstart' : 'mousedown'
        },
        $parent = $(this);

        $(this).find('ul').width(($items.outerWidth(true) + padding) * $items.length);

        if (/Android|iPhone|iPod|iPad/.test(navigator.userAgent) && // If it's an iPad, iPod or iPhone
            !(/OS [2-4]_\d(_\d)? like Mac OS X/i.test(navigator.userAgent))) { // And the version of the OS is bigger than 4.x...
            $(this).addClass('iOS');
        } else {
            // Touch devices (non-iOS or iOS < 5)
            var isWinPhone = /Windows Phone/.test(navigator.userAgent);

            if (T.getIsTouchDevice() && !T.isBlackBerryCurve()) {

                // Hide the arrows if it's not carouseltype1b
                if (!$(this).parent().hasClass('type1b')) {
                    $(this).parent().find('div:first-child ul').hide();
                }

                $(this).bind('touchstart', function(e) {
                    var clientX = e.originalEvent.changedTouches[0].clientX;

                    $(this).attr('startX', clientX);
                    $(this).attr('down', true);
                    $(this).attr('scrollLeft', $(this).scrollLeft());
                });

                $(this).bind('touchend', function(e) {
                    if ($(this).attr('active') === 'true') {
                        e.preventDefault();
                        e.stopPropagation();
                    }

                    $(this).attr('active', false);
                    $(this).attr('down', false);
                });

                $(this).bind('touchmove', function(e) {
                    var clientX = e.originalEvent.changedTouches[0].clientX,
                    sx = $(this).attr('startX') >> 0,
                    ex = clientX;

                    if (Math.abs(sx - ex) > 10) {
                        $(this).attr('active', true);
                    }

                    if ($(this).attr('active') === 'true') {
                        e.preventDefault();

                        $(this).scrollLeft(($(this).attr('scrollLeft') >> 0) + (sx - ex));
                    }

                    return false;
                });
            } else {
                // Force the arrows to show up
                $(this).parent().addClass('showArrows');
            }
        }

        // Support the click event on arrows
        $parent.parent().find('a.left').bind(Pointer.DOWN, function() {
            $parent.animate({
                'scrollLeft': $parent.scrollLeft() - $parent.width()
            }, animationDelay);
        });

        $parent.parent().find('a.right').bind(Pointer.DOWN, function() {
            $parent.animate({
                'scrollLeft': $parent.scrollLeft() + $parent.width()
            }, animationDelay);
        });
    });

}/*C://xampp//htdocs//TelevisaGit//\img_galry_01\js\img_galry_01.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\mix_3artspag_01\js\mix_3artspag_01.js*/

 /* ******************************************************* */ 
 $(document).ready(function() {

	$('.mix_3artspag_01 #mix_3artspag_01_vermas').click(function(event){
		
		event.preventDefault();
		$('.mix_3artspag_01 .items ul li').show();
		$('.mix_3artspag_01 #mix_3artspag_01_vermas').hide();
	});
	
});/*C://xampp//htdocs//TelevisaGit//\mix_3artspag_01\js\mix_3artspag_01.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\mix_3artspag_02\js\mix_3artspag_02.js*/

 /* ******************************************************* */ 
 $(document).ready(function() {
	
	$('.mix_3artspag_02 #mix_3artspag_02_vermas').click(function (event){
		
		event.preventDefault();
		$('.mix_3artspag_02 .items ul li').show();
		$('.mix_3artspag_02 #mix_3artspag_02_vermas').hide();
	});

});/*C://xampp//htdocs//TelevisaGit//\mix_3artspag_02\js\mix_3artspag_02.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\mix_4artspag_01\js\mix_4artspag_01.js*/

 /* ******************************************************* */ 
 $(document).ready(function() {

	$('.mix_4artspag_01 #mix_4artspag_01_vermas').click(function(event){
		
		event.preventDefault();
		$('.mix_4artspag_01 .items ul li').show();
		$('.mix_4artspag_01 #mix_4artspag_01_vermas').hide();
	});
	
});/*C://xampp//htdocs//TelevisaGit//\mix_4artspag_01\js\mix_4artspag_01.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\mix_6x2arts_01\js\mix_6x2arts_01.js*/

 /* ******************************************************* */ 
 jQuery(document).ready(function ($) {
    var $p = $('.mix_6x2arts_01');
    var cont = 0;
    $p.each(function() {
        var $parent = $(this);
        var $show = $parent.find('.mix_6x2arts_01_show');
        var $hide = $parent.find('.mix_6x2arts_01_hide');
        var $paginator = $parent.find('.nav_paginator_01');
        var $list = $parent.find('.mix_6x2arts_01_carousel ul li');
        if(cont == 0){
            $parent.find('.mix_6x2arts_01_carousel').slideDown();
            $paginator.slideDown();
        }

        else{
            $parent.find('.mix_6x2arts_01_carousel').slideUp();
            $paginator.slideUp();
            $show.addClass('selected');
            $hide.removeClass('selected');
        }
             

        $hide.click(function(e){
            e.preventDefault();
            var obj =  $parent.find('.mix_6x2arts_01_carousel');
            if(!$(this).hasClass('selected')){
                obj.slideDown();
                $paginator.slideDown();
                $show.removeClass('selected');
                $(this).addClass('selected');
            }
            
        });
        
        $show.click(function(e){
            e.preventDefault();
            var obj = $parent.find('.mix_6x2arts_01_carousel');
            if( !$(this).hasClass('selected')){
                obj.slideUp();
                $paginator.slideUp();
                $hide.removeClass('selected');
                $(this).addClass('selected');
            }
        });
        if ($(window).width() > 960){
            element_Margins(6);
        }
        if ( $(window).width() > 624 && $(window).width() <= 960){
            element_Margins(4);
        }
        $(window).resize(function() {
            if ($(window).width() > 960) {
                element_Margins(6);
            }
            if ($(window).width() > 624 && $(window).width() <= 960  ) {
                element_Margins(4);
            }
        });
        function element_Margins(total){
            var element = 1;
            if(total == 4){
                $list.each(function() {
                    if(element%4 == 0){
                        $(this).css({
                            'margin-right':'0px'
                        });
                    }
                    else{
                        $(this).css({
                            'margin-right':'25px'
                        }); 
                    }
                    element++;
                });
            }
            if(total == 6){
                $list.each(function() {
                    if(element%6 == 0){
                        $(this).css({
                            'margin-right':'0px'
                        });
                    }
                    else{
                        $(this).css({
                            'margin-right':'28px'
                        }); 
                    }
                    element++;
                });
            }
        }
        cont++;
    });
});
/*C://xampp//htdocs//TelevisaGit//\mix_6x2arts_01\js\mix_6x2arts_01.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\mix_carru_01\js\mix_carru_01.js*/

 /* ******************************************************* */ 
 $(document).ready(function() {


    $(".mix_carru_01 div.title a.right").click(function(e) {

        $(".mix_carru_01 ul.galleryThumbs li.active").next().trigger("click");
        e.stopPropagation();
    });

    $(".mix_carru_01 div.title a.left").click(function(e) {

        $(".mix_carru_01 ul.galleryThumbs li.active").prev().trigger("click");
        e.stopPropagation();
    });

    $(".mix_carru_01 ul.galleryThumbs li").bind("click", function(e) {
        var image = $(this).attr("image");
        var seccion = $(this).attr("seccion");
        var urlSeccion = $(this).attr("urlSeccion");
        var title = $(this).attr("title");
        var urlTitle = $(this).attr("urlTitle");

        $(this).parent().find("li").removeClass();
        $(this).addClass("active");

        var imgs = $(".mix_carru_01 .type2b .galleryImages img");
        $(imgs).removeClass("active");
        $(imgs[$(this).index()]).addClass("active");
        

        $(".mix_carru_01 .itemSection a").attr("href", urlSeccion);
        $(".mix_carru_01 .itemSection a").attr("title", seccion);
        $(".mix_carru_01 .itemSection a").text(seccion);

        $(".mix_carru_01 .itemCaption a").attr("href", urlTitle);
        $(".mix_carru_01 .itemCaption a").attr("title", title);
        $(".mix_carru_01 .itemCaption a").text(title);
        
        $(".mix_carru_01 .galleryImages img").removeClass("active");
        $(".mix_carru_01 .galleryImages #bigImgA img").addClass("active");
        var bullets = $(".mix_carru_01 .galleryCaption .bullets ul li");
        $(bullets).removeClass("selected");
        $(bullets[$(this).index()]).addClass("selected");
        e.stopPropagation();
    });


    var imgs = $(".mix_carru_01 .galleryImages img");
    if ($.browser.msie && parseFloat($.browser.version) <= 8) {
        width = $(document).width();
    }
    else {
        width = $(window).width();
    }
    if (width <= 624) {
        totalwidth = (width + 5) * imgs.length;
    }
    else {
        totalwidth = (628.33 * imgs.length) - 5;
    }
    if (width >= 625) {
        $(".mix_carru_01 .galleryImages").css({"width": "624.33"});
    }
    else {
        $(".mix_carru_01 .galleryImages").css({"width": totalwidth});
    }

    $(".mix_carru_01 .galleryImages").css({"width": width});


    

    $(window).resize(function(e) {
        width = $(window).width();
        totalwidth = ((width + 5) * imgs.length) - 5;
        if (width <= 624) {
            $(".mix_carru_01 .galleryImages").css({"width": width});
            //$(".mix_carru_01 .galleryImages ul").css({"width": totalwidth});

        } else {
            $(".mix_carru_01 .galleryImages").css({"width": 624.33});
            $(".galleryImages ul").css({"left": "0"});
            //$(".mix_carru_01 .galleryImages ul li").css({"width": "auto"});
        }
        if (width >= 625) {
            $(".mix_carru_01 ul.galleryThumbs li").removeClass("active");
            $(".mix_carru_01 ul.galleryThumbs li:first-child").addClass("active");
          

            var image = $(".mix_carru_01 ul.galleryThumbs li.active").attr("image");
            var seccion = $(".mix_carru_01 ul.galleryThumbs li.active").attr("seccion");
            var urlSeccion = $(".mix_carru_01 ul.galleryThumbs li.active").attr("urlSeccion");
            var title = $(".mix_carru_01 ul.galleryThumbs li.active").attr("title");
            var urlTitle = $(".mix_carru_01 ul.galleryThumbs li.active").attr("urlTitle");
            $(".mix_carru_01 div#bigImgA img").attr("src", image);

            $(".mix_carru_01 .itemSection a").attr("href", urlSeccion);
            $(".mix_carru_01 .itemSection a").attr("title", seccion);
            $(".mix_carru_01 .itemSection a").text(seccion);

            $(".mix_carru_01 .itemCaption a").attr("href", urlTitle);
            $(".mix_carru_01 .itemCaption a").attr("title", title);
            $(".mix_carru_01 .itemCaption a").text(title);
            $(".mix_carru_01 .bullets ul li").removeClass("selected");
            $(".mix_carru_01 .bullets ul li:first-child").addClass("selected");
            $(".mix_carru_01 .galleryImages a img").removeClass("active");
            $(".mix_carru_01 .galleryImages a:first-child img").addClass("active");
        }

    });
    
    var i=0;
    var wrap = $('.mix_carru_01 .galleryImages'),
            slides = wrap.find('img'),
            active = slides.filter('.active'),
            i = slides.index(active),
            width = wrap.width();
    slides.on('swipeleft', function(e) {
        if($(window).width()<=624){
            if (i === slides.length - 1) {
                return;
            }
            slides.eq(i + 1).trigger('activate');
        }
    }).on('swiperight', function(e) {
         if($(window).width()<=624){
            if (i === 0) {
                return;
            }
            slides.eq(i - 1).trigger('activate');
            }
    }).on('activate', function(e) {
        slides.eq(i).removeClass('active');

        jQuery(e.target).addClass('active');


        i = slides.index(e.target);
    }).on('movestart', function(e) {
        if ((e.distX > e.distY && e.distX < -e.distY) ||
                (e.distX < e.distY && e.distX > -e.distY)) {
            e.preventDefault();
            return;
        }
        wrap.addClass('notransition');
    }).on('move', function(e) {
        if($(window).width()<=624){
            var left = 100 * e.distX / width;
            if (e.distX < 0) {
                if (slides[i + 1]) {
                    slides[i].style.left = left + '%';
                    slides[i + 1].style.left = (left + 100) + '%';
                }
                else {
                    slides[i].style.left = left / 4 + '%';
                }

            }
        }
        if (e.distX > 0) {
            if (slides[i - 1]) {
                slides[i].style.left = left + '%';
                slides[i - 1].style.left = (left - 100) + '%';
            }
            else {
                slides[i].style.left = left / 5 + '%';
            }
        }
    }).on('moveend', function(e) {
        wrap.removeClass('notransition');

        slides[i].style.left = '';

        if (slides[i + 1]) {
            slides[i + 1].style.left = '';
        }
        if (slides[i - 1]) {
            slides[i - 1].style.left = '';
        }
        if($(slides[i]).hasClass("active")){
            var imgsthumbs = $(".mix_carru_01 .galleryThumbs li");
            var bullets = $(".mix_carru_01 .bullets ul li");
            for (var h = 0; h < bullets.length; h++) {
                if (i == h) {
                    $(bullets).removeClass("selected");
                    $(bullets[h]).addClass("selected");
                    var seccion = $(imgsthumbs[i]).attr("seccion");
                    var urlSeccion = $(imgsthumbs[i]).attr("urlSeccion");
                    var title = $(imgsthumbs[i]).attr("title");
                    var urlTitle = $(imgsthumbs[i]).attr("urlTitle");
                    $(".mix_carru_01 .itemSection a").attr("href", urlSeccion);
                    $(".mix_carru_01 .itemSection a").attr("title", seccion);
                    $(".mix_carru_01 .itemSection a").text(seccion);
                    $(".mix_carru_01 .itemCaption a").attr("href", urlTitle);
                    $(".mix_carru_01 .itemCaption a").attr("title", title);
                    $(".mix_carru_01 .itemCaption a").text(title);
                    break;
                }
            }
        }    
    });
});


var intervalIDCarru = window.setInterval("imgGalleryCarrusel()", (5 * 1000));


function imgGalleryCarrusel(){
        var bullets = $(".mix_carru_01 .galleryCaption .bullets ul li");
        for(var j=0; j<bullets.length; j++){
            var imgs = $(".mix_carru_01 .type2b .galleryImages img");
            var imgsthumbs = $(".mix_carru_01 .galleryThumbs li");
            if($(bullets[j]).hasClass("selected")){
                var width = $(imgs[j]).width();
                $(imgs[j]).animate({"left":"-="+width});
                $(imgs[j]).animate({"left":"+="+width});
                var z;
                if(j== (bullets.length-1) ){
                    z=0;
                }
                else{
                    z = j+1;
                }
                $(imgs).removeClass("active");
                $(imgs[z]).addClass("active");
                $(bullets).removeClass("selected");
                $(bullets[z]).addClass("selected");
                $(imgsthumbs).removeClass("active");
                $(imgsthumbs[z]).addClass("active");
                var seccion = $(imgsthumbs[z]).attr("seccion");
                var urlSeccion = $(imgsthumbs[z]).attr("urlSeccion");
                var title = $(imgsthumbs[z]).attr("title");
                var urlTitle = $(imgsthumbs[z]).attr("urlTitle");
                $(".mix_carru_01 .itemSection a").attr("href", urlSeccion);
                $(".mix_carru_01 .itemSection a").attr("title", seccion);
                $(".mix_carru_01 .itemSection a").text(seccion);
                $(".mix_carru_01 .itemCaption a").attr("href", urlTitle);
                $(".mix_carru_01 .itemCaption a").attr("title", title);
                $(".mix_carru_01 .itemCaption a").text(title);    
                break;
            }
        }
}

var isMobile = {
    Android: function() {
        return navigator.userAgent.match(/Android/i);
    },
    BlackBerry: function() {
        return navigator.userAgent.match(/BlackBerry/i);
    },
    iOS: function() {
        return navigator.userAgent.match(/iPhone|iPad|iPod/i);
    },
    Opera: function() {
        return navigator.userAgent.match(/Opera Mini/i);
    },
    Windows: function() {
        return navigator.userAgent.match(/IEMobile/i);
    },
    any: function() {
        return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
    }
};

/*C://xampp//htdocs//TelevisaGit//\mix_carru_01\js\mix_carru_01.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\nav_featured_01\js\nav_featured_01.js*/

 /* ******************************************************* */ 
 $(document).ready(function() {
    var button = $(".nav_featured_01_menu");
    var selectedButton = $(".selected");
    button.bind("click", function(){
        toggleSelect(this);
    });
    /*function toggleSelect(pressedButton){
        if($(pressedButton).hasClass("selected") === false){
            selectedButton.removeClass("selected");
            $(pressedButton).addClass("selected");
            selectedButton = $(pressedButton);
        }
    }*/
});
    /*C://xampp//htdocs//TelevisaGit//\nav_featured_01\js\nav_featured_01.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\str_notfound_01\js\str_notfound_01.js*/

 /* ******************************************************* */ 
 $(document).ready(function() {

	$('.str_notfound_01 #s').click(function () {
		
		if($(this).val() == 'Realiza otra busqueda')
			$(this).val('');
	});
	
	$('.str_notfound_01 #s').change(function () {
		
		if($(this).val() == '')
			$(this).val('Realiza otra busqueda');
	});
	
	$('.str_notfound_01 #s').blur(function () {
		
		if($(this).val() == '')
			$(this).val('Realiza otra busqueda');
	});
	
});/*C://xampp//htdocs//TelevisaGit//\str_notfound_01\js\str_notfound_01.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\str_pleca_03\js\str_pleca_03.js*/

 /* ******************************************************* */ 
 head.ready(function() {
    (function(T, $) {
        var $p = $('.str_pleca_container');
        $p.each(function() {
            var $parent = $(this);
            var $dropdown = $parent.find('.str_pleca_03_title h3 span');
            var $container = $parent.find('.content_hide');
            $dropdown.click(function(e) {
                e.preventDefault();
                if ($(this).hasClass('active')){
                    $(this).removeClass('active');
                    $parent.find('.str_pleca_03_title h3').css({
                        'border-bottom' : 'none'
                    });
                    $container.slideDown();
                }
                else{
                    $(this).addClass('active');
                    if($.browser.msie && parseFloat($.browser.version) <= 8){
                        $parent.find('.str_pleca_03_title h3').css({
                            'border-bottom' : '2px groove rgb(181,181,181)'
                        });
                    }
                    else{
                        $parent.find('.str_pleca_03_title h3').css({
                            'border-bottom' : '2px groove rgba(178, 178, 178,0.6)'
                        });
                    }
                    $container.slideUp();

                }
            })
        });
   
        $(window).resize(function() {
            if( $(window).width() >= 624 ){
                var $parent = $('.str_pleca_container');
                var $dropdown = $parent.find('.str_pleca_03_title h3 span');
                var $container = $parent.find('.content_hide');
                $dropdown.removeClass('active');
                $parent.find('.str_pleca_03_title h3').css({
                    'border-bottom' : 'none'
                });
                $container.slideDown();
            }
        });

    
    }(Televisa, jQuery));
});/*C://xampp//htdocs//TelevisaGit//\str_pleca_03\js\str_pleca_03.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\vid_4vids_01\js\vid_4vids_01.js*/

 /* ******************************************************* */ 
 


$(document).ready(function() {
	
	
(function(){
    
vid_4vids_01_player = new Object();
vid_4vids_01_player.width = 624; // Delay entre cambio y cambio de imagenes en el autoplay
vid_4vids_01_player.height = 378;
    
    // Si entran en movil se quita el ancho fijo que pone el carrusel al 'ul'
    $(window).load(function() {
            if($(window).width() <= 590){

                    $('.vid_4vids_01 .type1a .carruselContainer #carrusel').css('width', $(window).width());

            }
    });



    var anchoUL_carrusel;

    if($(window).width() > 620){

            anchoUL_carrusel = $('.vid_4vids_01 .type1a .carruselContainer #carrusel').width();
            //alert(anchoUL_carrusel);
    }



    /*$(window).resize(function() {
            //alert(ancho);
            if($(window).width() < 620){

                    $('.vid_4vids_01 .type1a .carruselContainer #carrusel').css('width','auto');

            }
            else{
                    $('.vid_4vids_01 .type1a .carruselContainer #carrusel').css('width', anchoUL_carrusel);
            }
    });*/
    
    var lis = $('.vid_4vids_01 .type1a .carruselContainer ul li');
   
        var margin_r = 0;
        var ulWidth = 0;
        for(var i=0; i<lis.length; i++){
            margin_r += parseInt($(lis[i]).css("margin-right"));
            ulWidth += $(lis[i]).width();
        }
        $('.vid_4vids_01 .type1a .carruselContainer ul').width(ulWidth + margin_r + 19);

    // Boton del VER MAS (Movil)
    $('.vid_4vids_01 #vid_4vids_01_btnverMas').click( function (e){
            e.preventDefault();
            $('.vid_4vids_01 .type1a #carrusel li').show();
    });


    // Bind del carrsuel 2 con la galeria escogida
    $('.vid_4vids_01 .galleryLink').click( function (event){
            event.preventDefault();
            // Si es version tablet o desktop
            if($(window).width() > 620){

					
                    // Quitamos el estilo y agregamos el estilo "sellecionado" a la imagen que le dieron click
                    $('.vid_4vids_01 .galleryLink').each( function (){

                            $(this).find('div.selectedGallery').removeClass('selectedGallery');
                    });

                    $(this).find('.iconGallery').addClass('selectedGallery');
            }

    });



    // Click  del btn play
    $('.vid_4vids_01 #video_play, .vid_4vids_01 .galleryLink').click(function (event){
            event.preventDefault();
            changePlayVideo($(this));

    });
    
    
function setPlayerSize(){
	
	if ($.browser.msie && parseInt($.browser.version, 10) <= 7){
		var anchoVentna = document.body.offsetWidth;
		//alert( anchoVentna );
	}
	else{
		var anchoVentna =  $(window).width();
	}
	
	// Si el version movil obtenemos el alto y ancho de la imagen para adaptar el tamaño del player
	if( anchoVentna <= 590 ){
		
		// proporcion entre el ancho y alto fijos con el ancho variable
		var altoVentana = (anchoVentna * vid_4vids_01_player.height) / vid_4vids_01_player.width;
		
		$('.vid_4vids_01 #myExperience').width( anchoVentna );
		$('.vid_4vids_01 #myExperience').height( altoVentana );
		
		$('.vid_4vids_01 #contenedor').width( anchoVentna );
		$('.vid_4vids_01 #contenedor').height( altoVentana );
	}
	else{
		
		$('.vid_4vids_01 #myExperience').width( vid_4vids_01_player.width );
		$('.vid_4vids_01 #myExperience').height( vid_4vids_01_player.height );
		
		$('.vid_4vids_01 #contenedor').width( vid_4vids_01_player.width );
		$('.vid_4vids_01 #contenedor').height( vid_4vids_01_player.height );
		
	}
}


function changePlayVideo(galleryIcon){
	
	
	
	
	if( typeof( modVP ) != "undefined"){
		
		if(modVP.isPlaying())
			modVP.stop();
		
		var player = new BCEsmasPlayer("myExperience",643082227001,"contenedor",params,options);
		player.removePlayer();
		player.addPlayer();
		openerSkin();
		
		modVP.play();
		//alert('play');
	}
	
	
	//var imgContainer = $(btnPlay).parent().parent();
	var imgContainer = $(galleryIcon).parents('.vid_4vids_01');
	//$(btnPlay).css('border', '1px solid red');
	
	//$('.vid_4vids_01 #theaterContainer').hide('fast', function(){
	setPlayerSize();
	
	
	//alert($(imgContainer).attr('id'));
	$(imgContainer).find('#theaterContainer').show();
	$(imgContainer).find('#img_stage_01_IMG').hide();
	$(imgContainer).find('#video_play').hide();
	$(imgContainer).find('.overlay').hide();
	//});
}
    

})();
        


});



/*C://xampp//htdocs//TelevisaGit//\vid_4vids_01\js\vid_4vids_01.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\vid_4vids_02\js\vid_4vids_02.js*/

 /* ******************************************************* */ 
 head.ready(function() {
    (function(T, $) {

        var $element = $('.vid_4vids_02');
        $element.each(function() {
            var $parent = $(this);
            if ($.browser.msie && parseFloat($.browser.version) <= 8) {
            }
            else {
                $(window).resize(function() {
                    if (($(window).width() > 960) || ($(window).width() > 623 && $(window).width() <= 960)) {
                        $parent.find('.vid_4vids_02_container ul li:gt(2)').hide();
                        $parent.find('.vid_4vids_02_container ul li:gt(2)').show();
                    }
                    else if ($(window).width() < 624) {
                        $parent.find('.vid_4vids_02_container ul li:gt(2)').hide();
                    }
                });
            }
            $parent.find('.vid_4vids_02_less').hide();
            $('.vid_4vids_02_more').click(function(event) {
                event.preventDefault();
                $(this).hide();
                $(this).next('div').show();
                $(this).parent().prev('div').find('ul li:gt(2)').show();
            });

            $('.vid_4vids_02_less').click(function(event) {
                event.preventDefault();
                $(this).hide();
                $(this).prev('div').show();
                $(this).parent().prev('div').find('ul li:gt(2)').hide();
            });
            if (T.getDeviceSize() === 'small') {
                $parent.find('.vid_4vids_02_container ul li:gt(2)').hide();
            }
            $(".vid_4vids_02").ready(function() {
                $vids = $(".vid_4vids_02");
                for (var j = 0; j < $vids.length; j++) {
                    var $vid = $vids[j];
                    if ($($vid).width() <= 310 && $($vid).width() > 280) {
                        var $lis = $($vid).find("li");
                        for (var i = 0; i < $lis.length; i++) {
                            var $li = $lis[i];
                            if (i % 2 == 0) {
                                $($li).css({
                                    "margin-left": "0",
                                    "margin-rigth": "24px"
                                });
                            }
                            else {
                                $($li).css({
                                    "margin-right": "0px"
                                });
                            }
                        }
                    } else {
                        if ($($vid).width() <= 648 && $($vid).width() >= 620) {
                            var $lis = $($vid).find("li");
                            for (var i = 1; i <= $lis.length; i++) {
                                var $li = $lis[i];
                                if(i%3==0){
                                   $($li).css({
                                        "margin-left": "0",
                                        "margin-right": "0"
                                    }); 
                                }
                                else{
                                    $($li).css({
                                        "margin-left": "0",
                                        "margin-right": "24px"
                                    });
                                }
                                if(i>=4){
                                    $($li).css({
                                        "display": "none"
                                    });
                                }
                            }
                        }
                        else{
                            if($($vid).width()>648){
                                $($vid).find("li:last-child").css({"margin-right":"0"});
                            }
                        }
                    }
                }
            });
            $(window).resize(function(){
                $vids = $(".vid_4vids_02");
                for (var j = 0; j < $vids.length; j++) {
                    var $vid = $vids[j];
                    if ($($vid).width() <= 310 && $($vid).width() > 280) {
                        var $lis = $($vid).find("li");
                        for (var i = 0; i < $lis.length; i++) {
                            var $li = $lis[i];
                            if (i % 2 == 0) {
                                $($li).css({
                                    "margin-left": "0",
                                    "margin-rigth": "24px"
                                });
                            }
                            else {
                                $($li).css({
                                    "margin-right": "0px"
                                });
                            }

                        }
                    } else {
                        if ($($vid).width() <= 648 && $($vid).width() >= 620) {
                            var $lis = $($vid).find("li");
                            for (var i = 1; i <= $lis.length; i++) {
                                var $li = $lis[i];
                                if(i%3==0){
                                   $($li).css({
                                        "margin-left": "0",
                                        "margin-right": "0"
                                    }); 
                                }
                                else{
                                    $($li).css({
                                        "margin-left": "0",
                                        "margin-right": "24px"
                                    });
                                }
                                if(i>=4){
                                    $($li).css({
                                        "display": "none"
                                    });
                                }
                            }
                            

                        }
                        else{
                            if($($vid).width()>648){
                                var $lis = $($vid).find("li");
                                for (var i = 1; i <= $lis.length; i++) {
                                    var $li = $lis[i];
                                    $($li).css({
                                        "margin-left": "0",
                                        "margin-right": "24px"
                                    });
                                    if(i>=4){
                                        $($li).css({
                                            "display": "block"
                                        });
                                    }
                                }
                                $($vid).find("li:last-child").css({"margin-right":"0"});
                            }
                        }
                    }
                }
            });

        });
    }(Televisa, jQuery));
});




/*C://xampp//htdocs//TelevisaGit//\vid_4vids_02\js\vid_4vids_02.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\vid_6vids_01\js\vid_6vids_01.js*/

 /* ******************************************************* */ 
 head.ready(function() {
    (function($, T) {

        var $m = $('.wdg_carousa div:last-child'),
                animationDelay = 500;
        var $w = $('.wdg_carousa div:last-child ul li');
        var $count = 0;
        $w.each(function() {
            $count++;
        });
        $m.each(function() {
            var $total = 160;
            if ($count <= 2) {
                $total = 60;
            }
            var $items = $(this).find('ul li'),
                    padding = ($(this).parent().hasClass('wdg_carousa')) ? 41 : 24,
                    Pointer = {
                UP: (T.getIsTouchDevice()) ? 'touchend' : 'mouseup',
                DOWN: (T.getIsTouchDevice()) ? 'touchstart' : 'mousedown'
            },
            $parent = $(this);

            $(this).find('ul').width(($items.outerWidth(true) + padding) * $items.length - $total);

            if (/Android|iPhone|iPod|iPad/.test(navigator.userAgent) && // If it's an iPad, iPod or iPhone
                    !(/OS [2-4]_\d(_\d)? like Mac OS X/i.test(navigator.userAgent))) { // And the version of the OS is bigger than 4.x...
                $(this).addClass('iOS');
            } else {

                // Touch devices (non-iOS or iOS < 5)
                var isWinPhone = /Windows Phone/.test(navigator.userAgent);

                if (T.getIsTouchDevice() && !T.isBlackBerryCurve()) {

                    // Hide the arrows if it's not carouseltype1b
                    /*if (!$(this).parent().hasClass('wdg_carousa')) {
                     $(this).parent().find('div:first-child ul').hide();
                     }*/

                    $(this).bind('touchstart', function(e) {
                        var clientX = e.originalEvent.changedTouches[0].clientX;

                        $(this).attr('startX', clientX);
                        $(this).attr('down', true);
                        $(this).attr('scrollLeft', $(this).scrollLeft());
                    });

                    $(this).bind('touchend', function(e) {
                        if ($(this).attr('active') === 'true') {
                            e.preventDefault();
                            e.stopPropagation();
                        }

                        $(this).attr('active', false);
                        $(this).attr('down', false);
                    });

                    $(this).bind('touchmove', function(e) {


                        var clientX = e.originalEvent.changedTouches[0].clientX,
                                sx = $(this).attr('startX') >> 0,
                                ex = clientX;

                        if (Math.abs(sx - ex) > 10) {
                            $(this).attr('active', true);
                        }

                        if ($(this).attr('active') === 'true') {
                            e.preventDefault();

                            $(this).scrollLeft(($(this).attr('scrollLeft') >> 0) + (sx - ex));
                        }
                        var width = $(window).width();
                        if (width <= 960) {
                            var bullets = $(".vid_6vids_01 .bullets ul li");
                            if(width<=625){
                                var totalWidth = $(".vid_6vids_01 .wdg_carousa div:last-child ul").width() - width;
                            }else{
                                var totalWidth = $(".vid_6vids_01 .wdg_carousa div:last-child ul").width() - 300;
                            }
                            var rank = totalWidth/5;
                            for (var h = 1; h <= bullets.length; h++) {
                                var limI = (rank * h)-rank;
                                var limS = rank * h; 
                                if( parseInt($(".vid_6vids_01 .wdg_carousa div:last-child").attr("scrollleft"))>=limI && parseInt($(".vid_6vids_01 .wdg_carousa div:last-child").attr("scrollleft"))<limS ) {
                                    $(bullets).removeClass("selected");
                                    $(bullets[h-1]).addClass("selected");
                                }
                            }
                        }
                        return false;
                    });
                } else {
                    // Force the arrows to show up
                    $(this).parent().addClass('showArrows');
                }
            }

            // Support the click event on arrows
            $parent.parent().find('a.wdg_carousa_left').click(function(e) {
                e.preventDefault();

                $parent.animate({
                    'scrollLeft': $parent.scrollLeft() - 329
                }, animationDelay);

            });

            $parent.parent().find('a.wdg_carousa_right').click(function(e) {
                e.preventDefault();
                $parent.animate({
                    'scrollLeft': $parent.scrollLeft() + 329
                }, animationDelay);
            });
        });

    }(jQuery, Televisa));
});

/*C://xampp//htdocs//TelevisaGit//\vid_6vids_01\js\vid_6vids_01.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\vid_6vids_01_1\js\vid_6vids_01.js*/

 /* ******************************************************* */ 
 $(document).ready(function() {
    var vids = $(".vid_6vids_01");
    for (var i = 0; i < vids.length; i++) {
        var vid = vids[i];
        var lis = $(vid).find(".wdg_carousa div:last-child ul li");
        var width;
        if ($(window).width() <= 624) {
            var widthDiv = parseFloat($(vid).find(".wdg_carousa div:last-child").width());
            width = widthDiv * lis.length;
            $(vid).find(".wdg_carousa div:last-child ul li").css({"width": (widthDiv)});
        }
        else {
            width = 154 * lis.length;
            $(vid).find(".wdg_carousa div:last-child ul li").css({"width": "136"});
        }
        $(vid).find(".wdg_carousa div:last-child ul").css({"width": width});

    }
    $(window).resize(function() {
        
        var vids = $(".vid_6vids_01");
        for (var i = 0; i < vids.length; i++) {
            var vid = vids[i];
            var lis = $(vid).find(".wdg_carousa div:last-child ul li");
            var width;
            if ($(window).width() <= 624) {
                var widthDiv = parseFloat($(vid).find(".wdg_carousa div:last-child").width());
                width = widthDiv * lis.length;
                $(vid).find(".wdg_carousa div:last-child ul li").css({"width": (widthDiv - 28)});
            }
            else {
                width = 154 * lis.length;
                $(vid).find(".wdg_carousa div:last-child ul li").css({"width": "136"});
            }
            $(vid).find(".wdg_carousa div:last-child ul").css({"width": width});

        }

    });
});
/*C://xampp//htdocs//TelevisaGit//\vid_6vids_01_1\js\vid_6vids_01.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\vid_player_01\js\vid_player_01.js*/

 /* ******************************************************* */ 
 vid_player_01_player = new Object();

vid_player_01_player.width = 625; // Delay entre cambio y cambio de imagenes en el autoplay
vid_player_01_player.height = 380;

$(document).ready(function() {
	
	// Si existe el componente de video
	if($('.vid_player_01')){
		
		// Click  del btn play
		$('.vid_player_01 #videobtn').click(function (){
			
			$('.vid_player_01 #img_stage_01_IMG').hide();
			$('.vid_player_01 #videobtn').hide();
			$('.vid_player_01 .vid_player_01_whtbkg').hide();
			
			
			
			setPlayerSize();
			
			$('.vid_player_01 #theaterContainer').show();
		});
		
		// ponemos el thumb y el titulo del video 
		
		/*if (typeof(objHtml5) != "undefined"){
			$('.vid_player_01 .vid_player_01_black').text(objHtml5.properties.title);
			$('.vid_player_01 #img_stage_01_IMG').attr('src', objHtml5.properties.thumbnail);
		}*/
		
		
		
		$(window).resize(function() {
			setPlayerSize();
		});
	}
	
});


function setPlayerSize(){
	
	if ($.browser.msie && parseInt($.browser.version, 10) <= 7){
		var anchoVentna = document.body.offsetWidth;
		
	}
	else{
		var anchoVentna =  $(window).width();
	}
	
	// Si el version movil obtenemos el alto y ancho de la imagen para adaptar el tamaño del player
	if( anchoVentna <= 590 ){
		
		// proporcion entre el ancho y alto fijos con el ancho variable
		var altoVentana = (anchoVentna * vid_player_01_player.height) / vid_player_01_player.width;
		
		$('.vid_player_01 #myExperience').width( anchoVentna );
		$('.vid_player_01 #myExperience').height( altoVentana );
		
		$('.vid_player_01 #contenedor').width( anchoVentna );
		$('.vid_player_01 #contenedor').height( altoVentana );
	}
	else{
		
		$('.vid_player_01 #myExperience').width( vid_player_01_player.width );
		$('.vid_player_01 #myExperience').height( vid_player_01_player.height );
		
		$('.vid_player_01 #contenedor').width( vid_player_01_player.width );
		$('.vid_player_01 #contenedor').height( vid_player_01_player.height );
		
	}
}/*C://xampp//htdocs//TelevisaGit//\vid_player_01\js\vid_player_01.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\vid_playr_01\js\vid_playr_01.js*/

 /* ******************************************************* */ 
 /* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


/*C://xampp//htdocs//TelevisaGit//\vid_playr_01\js\vid_playr_01.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\wdg_nwslt_01\js\wdg_nwslt_01.js*/

 /* ******************************************************* */ 
 function hideEmailText(){
	$('.email-txt').val("");
}

function showEmailText(){
    if($('.email-txt').val()==""){
        $('.email-txt').val("Correo electrónico");
    }
}
/*C://xampp//htdocs//TelevisaGit//\wdg_nwslt_01\js\wdg_nwslt_01.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\wdg_podcastpag_01\js\wdg_podcastpag_01.js*/

 /* ******************************************************* */ 
 (function() {
    $(document).ready(function() {
        
	$('.wdg_podcastpag_01 .wdg_podcastpag_01_show').click(function(e){
            e.preventDefault();
            
            $(this).next(".selected").removeClass("selected");
            $(this).addClass("selected"); 
            
            var parent = $(this).closest(".wdg_podcastpag_01");
            var podcasts = parent.find(".wdg_podcastpag_01_podcasts");
            var paginator = parent.find(".nav_paginator_01");    
            
            podcasts.slideUp('fast');
            paginator.slideUp('fast');

            
        });
        
        $('.wdg_podcastpag_01 .wdg_podcastpag_01_hide').click(function(e){
            e.preventDefault();
			$(this).prev(".selected").removeClass("selected");
            $(this).addClass("selected");
            

            var parent = $(this).closest(".wdg_podcastpag_01");
            var podcasts = parent.find(".wdg_podcastpag_01_podcasts");
            var paginator = parent.find(".nav_paginator_01");    
            
            podcasts.slideDown('fast');
            paginator.slideDown('fast');

        });
    });
}());/*C://xampp//htdocs//TelevisaGit//\wdg_podcastpag_01\js\wdg_podcastpag_01.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\wdg_poll_01\js\wdg_poll_01.js*/

 /* ******************************************************* */ 
 
(function() {
    $(document).ready(function() {
        $('#btn_wdg_poll_01').click(function(){
            $(".wdg_poll_01 form .wdg_poll_01_results").show();
            $(".wdg_poll_01 form .wdg_poll_01_options").hide();
            $(".wdg_poll_01 form .wdg_poll_01_submitbutton").hide();
            $(".wdg_poll_01 form .wdg_poll_01_total").show();

        });

    }); 
}());

 



/*C://xampp//htdocs//TelevisaGit//\wdg_poll_01\js\wdg_poll_01.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\wdg_sched_01\js\wdg_sched_01.js*/

 /* ******************************************************* */ 
 $(document).ready(function() {
//$(document).ready(function() {	
    jQuery(function($){ 
        (function($,T){
            $('.wdg_sched_01').each(function(ix,element){
            
                var $this = $(this), 
                Pointer = {
                    UP: (T.getIsTouchDevice()) ? 'touchend' : 'mouseup',
                    DOWN: (T.getIsTouchDevice()) ? 'touchstart' : 'mousedown'
                }, 
                $theUl = $this.find('>ul')
                ;
            
                $this.find('.arrows a.prev, .arrows a.next, .arrows .deportes-prev, .arrows .deportes-next').click(function(event){
                    event.preventDefault();
                });
            
                $this.find('a.prev, .deportes-prev').bind(Pointer.DOWN,function(){
                    $theUl.animate({
                        'scrollTop': $theUl.scrollTop() - $theUl.height()
                    }, 500);
                });
            
                $this.find('a.next, .deportes-next').bind(Pointer.DOWN,function(){
                    $theUl.animate({
                        'scrollTop': $theUl.scrollTop() + $theUl.height()
                    }, 500);

                });
            
            });
        })($,Televisa);
    });

}); 
/*C://xampp//htdocs//TelevisaGit//\wdg_sched_01\js\wdg_sched_01.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\wdg_social_01\js\wdg_social_01.js*/

 /* ******************************************************* */ 
 $(document).ready(function() {	

	// Quitamos la imagen que pone el script: http://comentarios.esmas.com/js/communities.js (redes sociales)
	$(window).load(function() {
		$('img[src*="vistas/spacer.gif"]').hide();
		$('#social_mailing').hide();
                $(".wdg_social_01 .social-icons ul li:last-child div").addClass("comments");
                
	});
        
        

});/*C://xampp//htdocs//TelevisaGit//\wdg_social_01\js\wdg_social_01.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\wdg_top10_01\js\wdg_top10_01.js*/

 /* ******************************************************* */ 
 head.ready(function() {
    (function($, T) {

        var $m = $('.wdg_carousa div:last-child'),
                animationDelay = 500;
        var $w = $('.wdg_carousa div:last-child ul li');
        var $count = 0;
        $w.each(function() {
            $count++;
        });
        $m.each(function() {
            var $total = 160;
            if ($count <= 2) {
                $total = 60;
            }
            var $items = $(this).find('ul li'),
                    padding = ($(this).parent().hasClass('wdg_carousa')) ? 41 : 24,
                    Pointer = {
                UP: (T.getIsTouchDevice()) ? 'touchend' : 'mouseup',
                DOWN: (T.getIsTouchDevice()) ? 'touchstart' : 'mousedown'
            },
            $parent = $(this);

            $(this).find('ul').width(($items.outerWidth(true) + padding) * $items.length - $total);

            if (/Android|iPhone|iPod|iPad/.test(navigator.userAgent) && // If it's an iPad, iPod or iPhone
                    !(/OS [2-4]_\d(_\d)? like Mac OS X/i.test(navigator.userAgent))) { // And the version of the OS is bigger than 4.x...
                $(this).addClass('iOS');
            } else {

                // Touch devices (non-iOS or iOS < 5)
                var isWinPhone = /Windows Phone/.test(navigator.userAgent);

                if (T.getIsTouchDevice() && !T.isBlackBerryCurve()) {

                    // Hide the arrows if it's not carouseltype1b
                    /*if (!$(this).parent().hasClass('wdg_carousa')) {
                     $(this).parent().find('div:first-child ul').hide();
                     }*/

                    $(this).bind('touchstart', function(e) {
                        var clientX = e.originalEvent.changedTouches[0].clientX;

                        $(this).attr('startX', clientX);
                        $(this).attr('down', true);
                        $(this).attr('scrollLeft', $(this).scrollLeft());
                    });

                    $(this).bind('touchend', function(e) {
                        if ($(this).attr('active') === 'true') {
                            e.preventDefault();
                            e.stopPropagation();
                        }

                        $(this).attr('active', false);
                        $(this).attr('down', false);
                    });

                    $(this).bind('touchmove', function(e) {


                        var clientX = e.originalEvent.changedTouches[0].clientX,
                                sx = $(this).attr('startX') >> 0,
                                ex = clientX;

                        if (Math.abs(sx - ex) > 10) {
                            $(this).attr('active', true);
                        }

                        if ($(this).attr('active') === 'true') {
                            e.preventDefault();

                            $(this).scrollLeft(($(this).attr('scrollLeft') >> 0) + (sx - ex));
                        }
                        var width = $(window).width();
                        if (width>= 480 && width <= 960) {
                            
                            var bullets = $(".wdg_top10_01 .bullets ul li");
                            var totalWidth = $(".wdg_top10_01 .wdg_carousa div:last-child ul").width() -300;
                            var rank = totalWidth/5;
                            for (var h = 1; h <= bullets.length; h++) {
                                var limI = (rank * h)-rank;
                                var limS = rank * h; 
                                if( parseInt($(".wdg_top10_01 .wdg_carousa div:last-child").attr("scrollleft"))>=limI && parseInt($(".wdg_top10_01 .wdg_carousa div:last-child").attr("scrollleft"))<limS ) {
                                    $(bullets).removeClass("selected");
                                    $(bullets[h-1]).addClass("selected");
                                }
                            }
                        }
                        return false;
                    });
                } else {
                    // Force the arrows to show up
                    $(this).parent().addClass('showArrows');
                }
            }

            // Support the click event on arrows
            $parent.parent().find('a.wdg_carousa_left').click(function(e) {
                e.preventDefault();

                $parent.animate({
                    'scrollLeft': $parent.scrollLeft() - 329
                }, animationDelay);

            });

            $parent.parent().find('a.wdg_carousa_right').click(function(e) {
                e.preventDefault();
                $parent.animate({
                    'scrollLeft': $parent.scrollLeft() + 329
                }, animationDelay);
            });
        });

    }(jQuery, Televisa));
});

/*C://xampp//htdocs//TelevisaGit//\wdg_top10_01\js\wdg_top10_01.js*/

 /* ******************************************************* */ 
 /*C://xampp//htdocs//TelevisaGit//\wdg_wethr_01\js\wdg_wethr_01.js*/

 /* ******************************************************* */ 
 
    (function() {
        $(document).ready(function() {
            if (!$.browser.opera) {
                $('select.select').each(function(){
                    var title = $(this).attr('title');
                    if( $('option:selected', this).val() != ''  ) title = $('option:selected',this).text();
                    $(this)
                    .css({
                        'z-index':10,
                        'opacity':0,
                        '-khtml-appearance':'none'
                    })
                    .after('<span class="select">' + title + '<span class="arrow">></span></span>')
                    .change(function(){
                        val = $('option:selected',this).text();
                        $(this).next().html( val + '<span class="arrow">></span>');
                    
                    });
                });
                
                //Mostrar elementos por estado 
                $("li.dos,li.tres,li.show").show()
                $("li.dos,li.tres,li.cuatro").hide()
                
                $('#states #cities').change(function(){
                    var valorID = $(this).find("option:selected").attr('id');
                    var text = $(this).find("option:selected").text();
                    
                    //console.log(valorID); 
                   
                    $('.wdg_wethr_01 .container-wdg ul').each(function(){
                        $("li.uno,li.dos,li.tres,li.cuatro[id!='"+ valorID +"']").hide()
                    });  
                    
                    if(valorID == "uno"){
                        $(".wdg_wethr_01 .container-wdg ul li.show").show();
                    }
                    else{
                        $(".wdg_wethr_01 .container-wdg ul li.show").hide();
                    }
                   
                    $(".wdg_wethr_01 .container-wdg ul li."+valorID).show();
                    
                    //Si valorID 
                    if(valorID == 0)
                    {
                        $('#wdg-active').hide();
                        $('.container-estates').show();
                    }
                    $(".wdg_wethr_01 span.select").html(text+"<span class='arrow'>></span>");
                   
                   
                });
                
                $('#states1 #cities').change(function(){
                    var valorID = $(this).find("option:selected").attr('id');
                    var text = $(this).find("option:selected").text();
                    //alert(valorID);
                    if(valorID!="0"){
                        $("#wdg-active").show();
                        $(".container-estates").hide();
                        $(".wdg_wethr_01 .container-wdg ul li.show").show();
                        if(valorID == "uno"){
                            $(".wdg_wethr_01 .container-wdg ul li.show").show();
                        } 
                        else{
                            $(".wdg_wethr_01 .container-wdg ul li.show").show();
                        }

                        $(".wdg_wethr_01 span.select").html(text+"<span class='arrow'>></span>");
                    }
                   
                });
                $('#wdg-active').hide();
                $('.container-estates').show();
                $(".wdg_wethr_01 #cities select.select option[value='0']").attr("selected");
                var texto = $(".wdg_wethr_01 .container-estates #states1 #cities option[value='0']").text();
                $(".wdg_wethr_01 span.select").html(texto+"<span class='arrow'>></span>");
            }; 
        }); 
    }());





/*C://xampp//htdocs//TelevisaGit//\wdg_wethr_01\js\wdg_wethr_01.js*/

 /* ******************************************************* */ 
 